<?
	@require_once("DatabaseConnection.php");
	@require_once("config.php");
	
	FirstConnect();
	
	function FirstConnect()
	{
		global $host,$dbUser,$dbPass,$dbName;
		global $name;
		
		$db = DatabaseConnection::GetDbcontroller();
		$db->host = $host;
		$db->dbUser = $dbUser;
		$db->dbPass = $dbPass;
		$db->dbName = $dbName;
		
		$rsOpen = $db->OpenConnection();
	}
	
	function ExecSQL($sql)
	{
		global $host,$dbUser,$dbPass,$dbName;
		global $name;
		
		$db = DatabaseConnection::GetDbcontroller();
		$db->host = $host;
		$db->dbUser = $dbUser;
		$db->dbPass = $dbPass;
		$db->dbName = $dbName;
		
		$rsOpen = $db->OpenConnection();
		
		$rsExec = @mysql_query($sql);
		$rows = @mysql_fetch_array($rsExec);
		return $rows;
	}
	
	function ExecSQLToArray($sql)
	{
		global $host,$dbUser,$dbPass,$dbName;
		global $name;
		
		$db = DatabaseConnection::GetDbcontroller();
		$db->host = $host;
		$db->dbUser = $dbUser;
		$db->dbPass = $dbPass;
		$db->dbName = $dbName;
		
		$rsOpen = $db->OpenConnection();
		
		$rsExec = @mysql_query($sql);
		
		while ($row = @mysql_fetch_row($rsExec))
		{
			$rs_arry[] = ($row);
		}
		return $rs_arry;
	}
	
	function ExecNonQuerySQL($sql)
	{
		global $host,$dbUser,$dbPass,$dbName;
		global $name;
		
		$db = DatabaseConnection::GetDbcontroller();
		$db->host = $host;
		$db->dbUser = $dbUser;
		$db->dbPass = $dbPass;
		$db->dbName = $dbName;
		
		$rsOpen = $db->OpenConnection();
		
		$rs = true;
		$rsExec = @mysql_query($sql) or die(@mysql_error);
		return $rs;
	}
?>